#include <WiFi.h>
#include "mywifi.h"
#include <Arduino.h>

#define LED 2

void connect_wifi(const char* ssid, const char* password) {
    WiFi.disconnect(true);
    WiFi.begin(ssid, password);
    Serial.printf("正在连接 Wi-Fi中");
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.printf(".");
    }
    Serial.printf("连接成功！");
    Serial.printf("IP address: ");
    Serial.printf("%s\n", WiFi.localIP());
    pinMode(LED, OUTPUT);
    digitalWrite(LED, HIGH);
}